|
|
|
|
|
|
|
intFileHandle = -1
strHeader = "Audit Log"
'
End Sub
Private Sub Class_Terminate()
'
' clean up loose ends
'
On Error Resume Next
'
Close #intFileHandle
'
End Sub |
|
|
|
|
|
|
|
|
The main method of the class is the WriteLog method. This method is the one you call to send an audit line to the log. Add a new Public subroutine called WriteLog to your logObject class and enter the code from Listing 21.37. |
|
|
|
|
|
|
|
|
Listing 21.37. Coding the WriteLog method. |
|
|
|
|
|
|
|
|
Public Sub WriteLog(ParamArray varParms() As Variant)
'
' write a log entry
'
On Error GoTo LocalErr
'
Dim lngItems As Long
Dim lngLoop As Long
Dim strLine As String
Dim vbQuote As String
Dim strUser As String
Dim strDate As String
'
vbQuote = Chr(34)
'
If intFileHandle = -1 Then
OpenLogFile
End If
'
If modUsrObject.strUserIDSaved = "" Then
strUser = "NO_USER"
Else
strUser = modUsrObject.strUserIDSaved
End If
'
' basic stuff
strLine = vbQuote & Format(Now(), "general date") & vbQuote & ","
strLine = strLine & vbQuote & strUser & vbQuote & ","
'
' stuff from caller
lngItems = UBound(varParms)
For lngLoop = 0 To lngItems |
|
|
|
|
|